/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package hotelsupplymanagement;

import java.beans.XMLEncoder;
import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintStream;


public class CLAdding {

    InputStreamReader ir;
    BufferedReader br;
    FileOutputStream fos;
    PrintStream ps;

    void CLaddProduct() throws FileNotFoundException, IOException
    {
                GetProducts p = new GetProducts();
                fos=new FileOutputStream("GUIProduct11.txt",true);
                ps=new PrintStream(fos);
                System.out.println("Enter Product Name :");
                p.setProductName(br.readLine());
                System.out.println("Enter Product Name :");
                p.setProductId(Integer.parseInt(br.readLine()));
                System.out.println("Enter Product Name :");
                p.setProductQuality(Integer.parseInt(br.readLine()));
                System.out.println("Enter Product Name :");
                p.setProductDescription(br.readLine());
                System.out.println("Enter Product Name :");
                p.setProductInvList(br.readLine());
                ps.println(p.getProductName()+","+p.getProductId()+","+p.getProductQuality()+","+p.getProductDescription()+","+p.getProductInvList());
                XMLEncoder e = new XMLEncoder(new BufferedOutputStream(new FileOutputStream("GUIProduct11.xml")));
                e.writeObject(p);
                e.close();
                fos.close();
    }

    void CLaddInventory() throws FileNotFoundException, IOException
    {
                GetInventories q = new GetInventories();
                fos=new FileOutputStream("GUIItem11.txt",true);
		ps=new PrintStream(fos);
                System.out.println("Enter Inventory Name :");
                q.setInventoryName(br.readLine());
                System.out.println("Enter Inventory ID :");
                q.setInventoryId(Integer.parseInt(br.readLine()));
                System.out.println("Enter Inventory Quality :");
                q.setInventoryQuantity(Integer.parseInt(br.readLine()));
                System.out.println("Enter Inventory Price :");
                q.setInventoryPrice(Integer.parseInt(br.readLine()));
		ps.println(q.getInventoryName()+","+q.getInventoryId()+","+q.getInventoryQuantity()+","+q.getInventoryPrice());
                XMLEncoder e = new XMLEncoder(new BufferedOutputStream(new FileOutputStream("GUIItem11.xml",true)));
                e.writeObject(q);
                e.close();
                fos.close();
    }

    
}
